function buildcnf()
{
    echo -e "\n\n==========开始生成my.cnf：$(date "+%Y-%m-%d %H:%M:%S")==========" >> $install_log
    [ ! -e $cnfbuild ] && exitscripts 4
    cat > my.cnf << EOF
[client]
port = $port
socket = $home_dir/mysql/run/mysql.sock

[mysqld]
port = $port
socket = $home_dir/mysql/run/mysql.sock
pid_file = $home_dir/mysql/run/mysql.pid
datadir = $home_dir/mysql/data
basedir = $home_dir/mysql
default_storage_engine = InnoDB
max_allowed_packet = 512M
max_connections = 2048
open_files_limit = 65535

skip-name-resolve
lower_case_table_names=1

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'


innodb_buffer_pool_size = 1024M
innodb_log_file_size = 2048M
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 0


key_buffer_size = 64M

log-error = $home_dir/mysql/log/mysql_error.log
log-bin = $home_dir/mysql/binlogs/mysql-bin
slow_query_log = 1
slow_query_log_file = $home_dir/mysql/log/mysql_slow_query.log
long_query_time = 5


tmp_table_size = 32M
max_heap_table_size = 32M
query_cache_type = 0
query_cache_size = 0

server-id=1
EOF
mkdir -p $home_dir/mysql/{conf,run,data,log,binlogs}
cp my.cnf $home_dir/mysql/conf/my.cnf
echo -e "\033[42;37m生成结束：my.cnf\033[0m"
echo -e "\n\n==========结束生成my.cnf：$(date "+%Y-%m-%d %H:%M:%S")==========" >> $install_log
}